$(function () {
    // alert(12);
    /* let userid = sessionStorage.getItem('id');
    // console.log(userid);
    // 未登录
    if (!userid) location.href = '/login.html' */
        
    $.ajax({
        url: 'http://139.9.177.51:3333/p2p/getuserinfo',
        type: 'GET',
        data: {
            userid: sessionStorage.getItem('id')
        },
        success: function (res) {
            // console.log(res);
            /* if (res.code == 200) {
                $('.nickname').html(res.data.nickname),
                $('.username').html(res.data.username),
                $('.email').html(res.data.email),
                $('.lastlogintime').html(res.data.lastlogintime),
                $('.regtime').html(res.data.regtime),
                $('.totalmoney').html(res.data.totalmoney),
                $('.usablemoney').html(res.data.usablemoney),
                $('.blockedmoney').html(res.data.blockedmoney)
            } else {
                alert('暂无信息~')
            } */
            $('.login a').html(res.data.nickname);
            // 遍历 for...in

            for (const key in res.data) {
                $(`.${key}`).html(res.data[key])
            }
        }
    })
})